package com.example.demo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@RestController
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/getNum")
    public int getNum(){
        Random random=new Random();
        System.out.println(random.nextInt(10));
        return random.nextInt(100);
    }
    @RequestMapping("/getUser")
    public String getUser(){
        Object o=null;
        o.hashCode();
        System.out.println("执行了getUser");
        return "执行getUser";
    }
    @RequestMapping("/login")
    public String getLogin(){
        int a=10/0;
        System.out.println("执行了getLogin");
        return "执行getLogin";
    }
    @RequestMapping("/test")
    public String getTest(){
        return "执行test";
    }
//    @GetMapping
//    public String getMethod(){
//        return "执行GET请求方式";
//    }
//
//    @PostMapping
//    public String postMethod(){
//        return "执行POST请求方法";
//    }
}
